<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/6/14
 * Time: 18:22
 */

namespace app\api\controller;

use app\api\Service\SignService;
use app\common\model\Sign as SignModel;
use app\common\controller\Api;
use think\Request;

class Sign extends Api
{
    protected $noNeedLogin = [];
    protected $noNeedRight = [];
    public    $signService;

    public function __construct(Request $request = null)
    {
        parent::__construct($request);
        $this->signService = SignService::getInstance();
    }

    /**
     * 签到天数
     */
    public function signday(SignModel $sign)
    {
        $condition = [strtotime('-1 week'),time()];
        $signdays = $sign->whereTime('daytime',$condition)->select(); //一周以内签到的
        $this->success('成功',$signdays);
    }

    /**
     * 签到动作
     */
    public function action()
    {
        $this->signService->action($this->auth->id);
    }
}